//指定session id
session_id("LD");
//啟動session
session_start();
//註冊
session_register("name");
session_register("pass");
//給定值
$_SESSION["name"]="hiyitou";
$_SESSION["pass"]="j21262126";
echo "3秒後,自動跳轉到t2.php";
header("refresh:3; url=t2.php");
//關閉輸出暫存器
ob_end_flush();
<?php
ob_start();
?>
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
//啟動session
session_start();
echo "session id 是".session_id()."<p>";
if (session_is_registered("name"))
{
echo "session name變數存在<br>";
echo "值為:".$_SESSION["name"]."<p>";
}
else
{
echo "session name變數不存在";
}
?>